home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / twelfth.wrl < prev    next >
Text File  |  1995-06-14  |  3KB  |  96 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example twelve - We're giving our objects DEF names.
  4.  
  5. # Here comes the Sun
  6. # The Separator node groups everything within it together
  7. Separator {
  8.  
  9.     # The material will effect all subsequent nodes
  10.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  11.     # We're switching to emissive color because the Sun gives off light.
  12.     Material {
  13.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  14.     }
  15.  
  16.     # The WWWAnchor node is a group node
  17.     # This means that all objects within it are linked with the anchor's URL
  18.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  19.     # Using the description field, we provide context for the user
  20.     # The DEF node attaches the name "SUN" to the WWWAnchor group
  21.     DEF SUN WWWAnchor {
  22.         name "http://www.w3.org/" # The root URL of the World Wide Web
  23.         description "A link from the Sun to W3.ORG" # Decriptive text
  24.  
  25.         # Inside the anchor, because WWWAnchor is a group node
  26.         Sphere {
  27.             radius 10        # Big Sun
  28.         }
  29.     }
  30.  
  31.     # We place the Earth within it's own Separator
  32.     # To keep everything good and isolated
  33.     Separator {
  34.  
  35.         # Let's move things out of the way here
  36.         Transform {
  37.             translation 0 20 20
  38.         }
  39.  
  40.         # Color the Earth blue, and make it absorb light
  41.         # But also make it a reflective, like water
  42.         Material {
  43.             diffuseColor 0 0 1 # Big blue marble
  44.             shininess 0.9 # Water is rather shiny
  45.         }
  46.  
  47.         # The WWWAnchor node is a group node
  48.         # This means that all objects within it are linked with the anchor's URL
  49.         # We want to link the Earth, so the Earth's Sphere node goes inside of it.
  50.         # Using the description field, we provide context for the user
  51.         # The DEF node attaches the name "Earth" to the WWWAnchor node
  52.         DEF EARTH WWWAnchor {
  53.             name "http://hyperreal.com/~mpesce/book/examples/second.wrl" # Another world
  54.             description "A link to another world" # Decriptive text
  55.  
  56.             # Finally, create the earth
  57.             Sphere {
  58.                 radius 2    # Little Earth
  59.             }
  60.         }
  61.  
  62.         # The Moon gets its own Separator
  63.         # Because we really do keep everything separate
  64.         Separator {
  65.  
  66.             # The Moon is just outside the Earth
  67.             Transform {
  68.                 translation 4 4 0
  69.             }
  70.  
  71.             # Color the Moon grey, make it absorb light
  72.             # It's a little shiny, but not much
  73.             Material {
  74.                 diffuseColor 0.7 0.7 0.7
  75.                 shininess 0.3
  76.             }
  77.  
  78.             # The WWWAnchor node is a group node
  79.             # This means that all objects within it are linked with the anchor's URL
  80.             # We want to link the Moon, so the Moon's Sphere node goes inside of it.
  81.             # Using the description field, we provide context for the user
  82.             # The DEF node attaches the name "Moon" to the WWWAnchor node
  83.             DEF Moon WWWAnchor {
  84.                 name "http://www.cyborganic.com:80/People/paul/The_new_dogs/pescewrd.au"
  85.                 description "Sounds from a talk about VRML"
  86.  
  87.                 # And now, create the Moon
  88.                 Sphere {
  89.                     radius 1    # Tiny Moon
  90.                 }
  91.             }
  92.         }
  93.     }
  94. }
  95.  
  96.